<div data-ng-controller="contractBaseCtrl">
    <div class="table-header clearfix ng-scope">
        <span class="fl lh30 f14">{{contractBaseInfo.contract_code_readonly}}</span>
    </div>

    <form name="contractBaseForm" class="form-horizontal" novalidate>
        <div class="section-title c-orange ml10 mt10"><em class="digit-circle">1</em><span class="ml10">客户信息</span>
        </div>
        <p ng-bind="areaRole"></p>
        <div class="form-group mt10">
            <span class="col-sm-3  control-label">客户性质</span>
            <div class="col-sm-5 clearfix">
                <div class="radio fl" style="margin-right:50px">
                    <input type="radio" ng-model="contractBaseInfo.customer_property" required value="0" id="rbt_dev"
                           name="customer_property" checked="checked">
                    <label for="rbt_dev">开发商</label>
                </div>
                <div class="radio fl">
                    <input type="radio" ng-model="contractBaseInfo.customer_property" required value="1" id="rbt_agent"
                           name="customer_property">
                    <label for="rbt_agent">代理商</label>
                </div>
                <span role="alert" style="clear:both;"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.customer_property.$touched) && contractBaseForm.customer_property.$error.required"
                      class="clearfix error ng-hide c-red lh30">请选择客户性质</span>
            </div>

            <span class="col-sm-3 control-label">合同属性</span>
            <div class="col-sm-9 clearfix">
                <div class="checkbox fl" style="margin-right:50px" ng-repeat="text in attribute_name_text">
                    <input type="checkbox" name="attribute_name_arr" ng-model="attribute_name_arr[$index]"
                           ng-true-value='"true"' ng-false-value='"false"' id="attribute_{{$index}}"><label
                        for="attribute_{{$index}}">{{text}}</label>
                </div>
                <span role="alert" style="clear:both;"
                      ng-show="(contractBaseForm.$submitted || attribute_name_arr.$touched) && attribute_name_arr.$error.required"
                      class="clearfix error ng-hide c-red lh30">请选择合同属性</span>
            </div>

        </div>

        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">客户简称</span>

            <div class="col-sm-5">
                <input id="idCustomerName" name="customer_id" select2 required ng-model="contractBaseInfo.customer_id"
                       select2-model="ddl2Customer"
                       config="ddlConfigCustomer" class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.customer_id.$touched) && contractBaseForm.customer_id.$error.required"
                      class="error ng-hide c-red lh30">客户简称不能为空</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">顶级客户简称</span>

            <div class="col-sm-5">
                <input type="text" ng-model="contractBaseInfo.top_customer_name" class="form-control" id="inputtext3"
                       ng-disabled="true" placeholder="顶级客户简称">
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">签约客户全称</span>

            <div class="col-sm-5">
                <input type="text" ng-model="contractBaseInfo.customer_full_name" class="form-control" id="inputtext3"
                       ng-disabled="true" placeholder="签约客户简称">
            </div>
            <div class="col-sm-23 relative pb10 ml25 pull-right mr10">
                <div class="border-bottom-dashed pl10 relative"></div>
            </div>

        </div>

        <!-- 合同信息 -->
        <div class="section-title c-orange ml10 mt10"><em class="digit-circle">2</em><span class="ml10">合同信息</span>
        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">合同性质</span>

            <div class="col-sm-5">
                <input select2 required name="contract_property_id"
                       ng-model="contractBaseInfo.contract_property_id"
                       select2-model="ddl2Nature"
                       config="ddlConfigContractNature"
                       class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.contract_property_id.$touched) && contractBaseForm.contract_property_id.$error.required"
                      class="error ng-hide c-red lh30">请选择合同性质</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">合同签署公司</span>

            <div class="col-sm-5">
                <input id="idCompanyId" select2 required name="company_id" ng-model="contractBaseInfo.company_id"
                       select2-model="ddl2Company" config="ddlConfigCompany"
                       class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.company_id.$touched) && contractBaseForm.company_id.$error.required"
                      class="error ng-hide c-red lh30">请选择合同签署公司</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">合同编号</span>

            <div class="col-sm-5">
                <input type="text" required maxlength="200" name="contract_code"
                       ng-model="contractBaseInfo.contract_code" class="form-control" id="inputtext3"
                       placeholder="合同编号" ng-disabled="true">
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.contract_code.$touched) && contractBaseForm.contract_code.$error.required"
                      class="error ng-hide c-red lh30">合同编号不能为空</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.contract_code.$touched) && contractBaseForm.contract_code.$error.maxlength"
                      class="error ng-hide c-red lh30">合同编号不能超过50个字符</span>
            </div>
        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">合同类别</span>

            <div class="col-sm-5">
                <input select2 required name="category_id" ng-model="contractBaseInfo.category_id"
                       select2-model="ddl2Category"
                       config="ddlConfigContractCategory" class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.category_id.$touched) && contractBaseForm.category_id.$error.required"
                      class="error ng-hide c-red lh30">请选择合同类别</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">合同大类</span>

            <div class="col-sm-5">
                <input select2 required name="big_category_id" ng-model="contractBaseInfo.big_category_id"
                       select2-model="ddl2BigClass"
                       config="ddlConfigContractBigClass" class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.big_category_id.$touched) && contractBaseForm.big_category_id.$error.required"
                      class="error ng-hide c-red lh30">请选择合同大类</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">合同小类</span>

            <div class="col-sm-5">
                <input id="idSmallClass" select2 name="littler_category_id"
                       ng-model="contractBaseInfo.littler_category_id" select2-model="ddl2SmallClass"
                       config="ddlConfigContractSmallClass" required="" class="form-control" type="text"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.littler_category_id.$touched) && contractBaseForm.littler_category_id.$error.required"
                      class="error ng-hide c-red lh30">合同小类不能为空</span>
            </div>
        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">合同签署日期</span>

            <div class="col-sm-5">
                <input type="text" class="input-date fl form-control" style="width:100%"
                       ui-date format="yyyy-MM-dd" required name="sign_date" ng-model="contractBaseInfo.sign_date"
                       placeholder="合同签署日期"
                >
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.sign_date.$touched) && contractBaseForm.sign_date.$error.required"
                      class="error ng-hide c-red lh30">合同签署日期不能为空</span>
            </div>
            <span for="inputtext3" class="col-sm-3 control-label">合同录入日期</span>

            <div class="col-sm-5">
                <input type="text" class="input-date fl form-control" style="width:100%"
                       ui-date format="yyyy-MM-dd" ng-model="contractBaseInfo.input_date" placeholder="保存后自动生成"
                       ng-disabled="true">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">合同生效日期</span>

            <div class="col-sm-5">
                <input type="text" class="input-date fl form-control" style="width:100%"
                       ui-date format="yyyy-MM-dd" ng-model="contractBaseInfo.effect_date" placeholder="合同生效日期"
                       ng-disabled="true">
            </div>

            <div class="col-sm-23 relative pb10 ml25 pull-right mr10">
                <div class="border-bottom-dashed pl10 relative"></div>
            </div>

        </div>
        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">合同签约人</span>

            <div class="col-sm-5">
                <input id="idSigner" select2 required name="sign_people_id" ng-model="contractBaseInfo.sign_people_id"
                       select2-model="ddl2Signer"
                       config="ddlConfigContractSigner" class="form-control" type="text" placeholder="合同签约人"/>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.sign_people_id.$touched) && contractBaseForm.sign_people_id.$error.required"
                      class="error ng-hide c-red lh30">请选择合同签约人</span>
            </div>


            <span for="inputtext3" class="col-sm-3 control-label">合同所属区域</span>
            <div class="col-sm-5">
                <input type="text" name="area_name" ng-model="contractBaseInfo.area_name" class="form-control"
                       id="inputtext3" ng-disabled="true" placeholder="合同所属区域">
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">签约人所属部门</span>
            <div class="col-sm-5">
                <input type="text" name="sign_people_department_name"
                       ng-model="contractBaseInfo.sign_people_department_name" class="form-control" id="inputtext3"
                       ng-disabled="true" placeholder="签约人所属部门">
            </div>


        </div>

        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">签约金额</span>

            <div class="col-sm-5">
                <input type="number" name="sign_amount" number required min="0" ng-model="contractBaseInfo.sign_amount"
                       class="form-control align-r" id="inputtext3" placeholder="签约金额">
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.sign_amount.$touched) && contractBaseForm.sign_amount.$error.required"
                      class="error ng-hide c-red lh30">签约金额不能为空</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.sign_amount.$touched) && contractBaseForm.sign_amount.$error.number"
                      class="error ng-hide c-red lh30">签约金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.sign_amount.$touched) && contractBaseForm.sign_amount.$error.min"
                      class="error ng-hide c-red lh30">签约金额必须大于等于0</span>
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">产品租用金额</span>
            <div class="col-sm-5">
                <input type="number" number required min="0" name="rent_amount" ng-model="contractBaseInfo.rent_amount"
                       class="form-control align-r" id="inputtext3" placeholder="产品租用金额">
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.rent_amount.$touched) && contractBaseForm.rent_amount.$error.required"
                      class="error ng-hide c-red lh30">产品租用金额不能为空</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.rent_amount.$touched) && contractBaseForm.rent_amount.$error.number"
                      class="error ng-hide c-red lh30">产品租用金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.rent_amount.$touched) && contractBaseForm.rent_amount.$error.min"
                      class="error ng-hide c-red lh30">产品租用金额必须大于等于0</span>
            </div>

            <span for="inputtext3" class="col-sm-3 control-label">交付金额</span>
            <div class="col-sm-5">
                <input type="number" number required min="0" name="delivery_amount"
                       ng-model="contractBaseInfo.delivery_amount" class="form-control align-r" id="inputtext3"
                       placeholder="交付金额">
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.delivery_amount.$touched) && contractBaseForm.delivery_amount.$error.required"
                      class="error ng-hide c-red lh30">交付金额不能为空</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.delivery_amount.$touched) && contractBaseForm.delivery_amount.$error.number"
                      class="error ng-hide c-red lh30">交付金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.delivery_amount.$touched) && contractBaseForm.delivery_amount.$error.min"
                      class="error ng-hide c-red lh30">交付金额必须大于等于0</span>
            </div>

        </div>

        <div class="form-group mt10">
            <span for="inputtext3" class="col-sm-3 control-label">收入金额</span>

            <div class="col-sm-5">
                <input type="number" name="income_amount" number required min="0"
                       ng-disabled="contractBaseInfo.isLimitContractNature" ng-model="contractBaseInfo.income_amount"
                       class="form-control align-r" placeholder="收入金额">
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.income_amount.$touched) && contractBaseForm.income_amount.$error.required"
                      class="error ng-hide c-red lh30">收入金额不能为空</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.income_amount.$touched) && contractBaseForm.income_amount.$error.number"
                      class="error ng-hide c-red lh30">收入金额必须是数值类型</span>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.income_amount.$touched) && contractBaseForm.income_amount.$error.min"
                      class="error ng-hide c-red lh30">收入金额必须大于等于0</span>
            </div>

            <span for="erp_contract_code" class="col-sm-3 control-label"
                  ng-show="contractBaseInfo.contract_property_id == '54f8a2b7-fce7-11e4-bed8-00155d02c832'">关联ERP合同编号</span>
            <div class="col-sm-5"
                 ng-show="contractBaseInfo.contract_property_id == '54f8a2b7-fce7-11e4-bed8-00155d02c832'">
                <input type="text" id="erp_contract_code" name="erp_contract_code"
                       ng-model="contractBaseInfo.erp_contract_code" class="form-control align-r"
                       placeholder="关联ERP合同编号">
            </div>

            <div class="col-sm-23 relative pb10 ml25 pull-right mr10">
                <div class="border-bottom-dashed pl10 relative"></div>
            </div>

        </div>
        <!-- 项目列表 -->
        <div>
            ${require('./base-inc-projects.html')}
        </div>

        <!--合同主责人-->
        <div ng-if="showPrincipal">
            ${require('./base-inc-principal.html')}
        </div>

        <div class="form-group mt20">
            <span class="col-sm-2 control-label" style="margin-left:-12px">备注</span>
            <div class="col-sm-20">
                <textarea name="contract_remark" id="" class="form-control" rows="3"
                          ng-model="contractBaseInfo.contract_remark" ng-maxlength="500"></textarea>
                <span role="alert"
                      ng-show="(contractBaseForm.$submitted || contractBaseForm.contract_remark.$touched) && contractBaseForm.contract_remark.$error.maxlength"
                      class="error ng-hide c-red lh30">备注信息不能超过500个字符</span>
            </div>
        </div>
    </form>
</div>
